# Maintainer: Lubosz Sarnecki <lubosz@gmail.com>

_srcname=gstreamer-editing-services
_realname=gst-editing-services
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.6.1
pkgrel=1
pkgdesc="GStreamer Editing Services (mingw-w64)"
arch=('any')
url="https://gstreamer.freedesktop.org/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python2")
depends=("${MINGW_PACKAGE_PREFIX}-gst-plugins-base"
         "${MINGW_PACKAGE_PREFIX}-gstreamer")
options=(!libtool strip staticlibs)
source=(https://gstreamer.freedesktop.org/src/${_realname}/${_srcname}-${pkgver}.tar.xz
        0002-add-cflags-for-gir.patch
        0003-fix-introspection-syntax.patch)
sha256sums=('f5f7e97db04faeaf6ec941652e75221e244b88e570720e031965d81b759e7bd2'
            '9d4c26c60c6a1b2ef4430c82ff5fcbf06f1aae61572ec005b387bb5419564e78'
            '493502eb5986d35bedf6ac7e3a471de135bc68b22309e273017c41823db67a80')

prepare() {
  cd ${_srcname}-${pkgver}
  patch -p1 -i ${srcdir}/0002-add-cflags-for-gir.patch
  patch -p1 -i ${srcdir}/0003-fix-introspection-syntax.patch

  autoreconf -fiv
  #NOCONFIGURE=1 ./autogen.sh
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_srcname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --disable-static \
    --enable-shared \
    --enable-silent-rules \
    --disable-gtk-doc

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make -j1 DESTDIR="${pkgdir}" install
  find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
  rm -f ${pkgdir}${MINGW_PREFIX}/lib/gstreamer*/*.a
}
